<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<title>Document</title>
	<script src="../lib/vue.js"></script>
</head>
<body>
	<div id="box">
		<button @click="flag='aaa'">aaa组件</button>
		<button @click="flag='bbb'">bbb组件</button>
		<component :is="flag"></component>
	</div>

	<script>
		new Vue({
			el: "#box",
			data: {
				flag: "aaa"
			},
			components: {
				"aaa": {
					template: "<h1>我是aaa组件</h1>"
				},
				"bbb": {
					template: "<h1>我是bbb组件</h1>"
				}
			}
		})
	</script>
</body>
</html>